package memento.fromCSDN.usingInnerClass;

public class Client {
    public static void main(String args[]) {
        MementoCaretaker mc = new MementoCaretaker();
        Chessman chess = new Chessman("车",1,1);
        display(chess);
        mc.setMenento(chess.save());
        chess.setY(4);
        display(chess);
        mc.setMenento(chess.save());
        display(chess);
        chess.setX(5);
        display(chess);
        System.out.println("******悔棋******");
        chess.restore(mc.getMenento());
        display(chess);
    }

    public static void display(Chessman chess){
        System.out.println("'" + chess.getLabel() + "'当前位置:\t" + chess.getX() + "-" + chess.getY());
    }
}
